/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FormKelolaTagihan.java
 *
 * Created on 08 Nov 12, 11:09:43
 */
package sistemPembayaranSPP;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author w7
 */
public class FormKelolaTagihan extends javax.swing.JFrame {

    /**
     * Creates new form FormKelolaTagihan
     */
    public FormKelolaTagihan() {
        initComponents();
        setTitle("Form Kelola Tagihan");
        nis();
        jInternalFrame.setVisible(false);
        
        tNamaSiswa.requestFocus();

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        tNIS = new javax.swing.JTextField();
        tNamaSiswa = new javax.swing.JTextField();
        tNamaKelas = new javax.swing.JTextField();
        tTahunAjaran = new javax.swing.JTextField();
        tBiayaBulan = new javax.swing.JTextField();
        tNamaOrtu = new javax.swing.JTextField();
        tNoTelepon = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        tJenisKelamin = new javax.swing.JTextField();
        jInternalFrame = new javax.swing.JInternalFrame();
        jLabel10 = new javax.swing.JLabel();
        tCariSiswa = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabelTagihan = new javax.swing.JTable();
        bKeluarTabel = new javax.swing.JButton();
        bHapus = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        bSimpan = new javax.swing.JButton();
        bBatal = new javax.swing.JButton();
        bLihat = new javax.swing.JButton();
        bKeluar = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        totalBiayaJteksField = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(51, 102, 204));

        jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
        jLabel8.setText("KELOLA TAGIHAN SISWA");

        jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/logo.jpg"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel15)
                .addGap(81, 81, 81)
                .addComponent(jLabel8)
                .addContainerGap(158, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(25, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(36, 36, 36))))
        );

        jPanel2.setBackground(new java.awt.Color(153, 153, 255));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel1.setText("NIS");

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel2.setText("Nama Siswa");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel3.setText("Kelas");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel4.setText("Tahun Ajaran");

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel5.setText("Biaya Bulan");

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel6.setText("Nama Orang Tua");

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel7.setText("No. Telepon");

        tTahunAjaran.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tTahunAjaranActionPerformed(evt);
            }
        });

        tBiayaBulan.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tBiayaBulanKeyReleased(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel9.setText("Jenis Kelamin");

        jInternalFrame.setVisible(true);

        jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        jLabel10.setText("Cari Siswa berdasarkan nama:");

        tCariSiswa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tCariSiswaKeyPressed(evt);
            }
        });

        tabelTagihan.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "NIS", "Kelas", "Nama Siswa", "Tahun Ajaran", "Biaya Bulan"
            }
        ));
        tabelTagihan.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelTagihanMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tabelTagihan);
        tabelTagihan.getColumnModel().getColumn(2).setResizable(false);
        tabelTagihan.getColumnModel().getColumn(3).setResizable(false);

        bKeluarTabel.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        bKeluarTabel.setText("Keluar");
        bKeluarTabel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bKeluarTabelActionPerformed(evt);
            }
        });

        bHapus.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        bHapus.setText("Hapus");
        bHapus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bHapusActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jInternalFrameLayout = new javax.swing.GroupLayout(jInternalFrame.getContentPane());
        jInternalFrame.getContentPane().setLayout(jInternalFrameLayout);
        jInternalFrameLayout.setHorizontalGroup(
            jInternalFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jInternalFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jInternalFrameLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(tCariSiswa, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jInternalFrameLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel10))
                    .addGroup(jInternalFrameLayout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addGroup(jInternalFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(bKeluarTabel)
                            .addComponent(bHapus))))
                .addGap(19, 19, 19))
        );
        jInternalFrameLayout.setVerticalGroup(
            jInternalFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrameLayout.createSequentialGroup()
                .addContainerGap(84, Short.MAX_VALUE)
                .addGroup(jInternalFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jInternalFrameLayout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addGap(19, 19, 19)
                        .addComponent(tCariSiswa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(bHapus))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(bKeluarTabel)
                .addGap(17, 17, 17))
        );

        jPanel3.setBackground(new java.awt.Color(155, 155, 255));

        bSimpan.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        bSimpan.setText("Simpan");
        bSimpan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bSimpanActionPerformed(evt);
            }
        });

        bBatal.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        bBatal.setText("Batal");
        bBatal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bBatalActionPerformed(evt);
            }
        });

        bLihat.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        bLihat.setText("Lihat");
        bLihat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bLihatActionPerformed(evt);
            }
        });

        bKeluar.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        bKeluar.setText("Keluar");
        bKeluar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bKeluarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(26, Short.MAX_VALUE)
                .addComponent(bSimpan)
                .addGap(40, 40, 40)
                .addComponent(bBatal)
                .addGap(57, 57, 57)
                .addComponent(bLihat)
                .addGap(53, 53, 53)
                .addComponent(bKeluar)
                .addGap(32, 32, 32))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bBatal)
                    .addComponent(bSimpan)
                    .addComponent(bKeluar)
                    .addComponent(bLihat))
                .addContainerGap(16, Short.MAX_VALUE))
        );

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel11.setText("Total Biaya");

        totalBiayaJteksField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                totalBiayaJteksFieldActionPerformed(evt);
            }
        });

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel12.setText("P / L");

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel13.setText("1 / 2 / 3");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3)
                            .addComponent(jLabel9)
                            .addComponent(jLabel4)
                            .addComponent(jLabel7)
                            .addComponent(jLabel6)
                            .addComponent(jLabel5)
                            .addComponent(jLabel11))
                        .addGap(14, 14, 14)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(tTahunAjaran)
                            .addComponent(tNoTelepon)
                            .addComponent(tNamaOrtu)
                            .addComponent(tNamaSiswa, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
                            .addComponent(totalBiayaJteksField)
                            .addComponent(tBiayaBulan, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(tJenisKelamin)
                                    .addComponent(tNamaKelas, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel12)))
                            .addComponent(tNIS)))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jInternalFrame, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(50, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(tNIS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(tNamaSiswa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel9))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tNamaKelas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tJenisKelamin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tBiayaBulan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addGap(13, 13, 13)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(totalBiayaJteksField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(tNamaOrtu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(tNoTelepon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(tTahunAjaran, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jInternalFrame, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1012, 1012, 1012))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 569, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tTahunAjaranActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tTahunAjaranActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tTahunAjaranActionPerformed

    private void bSimpanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bSimpanActionPerformed
        // TODO add your handling code here:
        String nis = tNIS.getText();
        String namaSiswa = tNamaSiswa.getText();
        String namaKelas = tNamaKelas.getText();
        String jenisKelamin = tJenisKelamin.getText();
        String thAjaran = tTahunAjaran.getText();
        String namaOrtu = tNamaOrtu.getText();
        String noTelpon = tNoTelepon.getText();
        String biayaBulan = tBiayaBulan.getText();
        String total = totalBiayaJteksField.getText();

        System.out.println(" " + tNIS.getText());
        System.out.println(" " + tNamaSiswa.getText());
        System.out.println(" " + tNamaKelas.getText());
        System.out.println(" " + tTahunAjaran.getText());
        System.out.println(" " + tJenisKelamin.getText());
        System.out.println(" " + tNamaOrtu.getText());
        System.out.println(" " + tNoTelepon.getText());
        System.out.println(" " + tBiayaBulan.getText());
        System.out.println("" + totalBiayaJteksField.getText());

        if (bSimpan.getText().equals("Simpan")) {
            TagihanSiswa k = new TagihanSiswa();
            k.setNIS(nis);
            k.setNama(namaSiswa);
            k.setNama_kelas(namaKelas);
            k.setTahunAjaran(thAjaran);
            k.setJenis_kelamin(jenisKelamin);
            k.setNama_ortu(namaOrtu);
            k.setNo_tlepn(noTelpon);
            k.setBiayaBulan(biayaBulan);
            k.setTotal(total);
            try {
                Kontrol.getKoneksiTagihan().tambahDataTagihanSiswa(k);
                JOptionPane.showMessageDialog(this, "data tagihan siswa berhasil disimpan");
                nis();
                batal();
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(this, "data gagal disimpan" + " \n error: " + ex.getMessage());
            }
        } else {
            TagihanSiswa k = new TagihanSiswa();
            k.setNIS(nis);
            k.setNama_kelas(namaKelas);
            k.setNama(namaSiswa);
            k.setTahunAjaran(thAjaran);
            k.setBiayaBulan(biayaBulan);

            try {
                Kontrol.getKoneksiTagihan().updateTagihanSiswa(k);
                JOptionPane.showMessageDialog(this, "data berhasil diupdate");

            } catch (SQLException ex) {
                Logger.getLogger(FormKelolaTagihan.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        batal();
    }//GEN-LAST:event_bSimpanActionPerformed

    private void bLihatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bLihatActionPerformed
        // TODO add your handling code here:
        jInternalFrame.setVisible(true);
        try {
            List<TagihanSiswa> b = (List<TagihanSiswa>) Kontrol.getKoneksiTagihan().getDataTagihanSiswa();
            KelolaTagihanTableModel model = new KelolaTagihanTableModel(b);
            tabelTagihan.setModel(model);
        } catch (Exception e) {
            Logger.getLogger(FormKelolaTagihan.class.getName()).log(Level.SEVERE, null, e);
        }
    }//GEN-LAST:event_bLihatActionPerformed

    private void tCariSiswaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tCariSiswaKeyPressed
        // TODO add your handling code here:
        try {
            List<TagihanSiswa> b = (List<TagihanSiswa>) Kontrol.getKoneksiTagihan().CariTagihanSiswa(tCariSiswa.getText());
            KelolaTagihanTableModel model = new KelolaTagihanTableModel(b);
            tabelTagihan.setModel(model);
        } catch (Exception e) {
            Logger.getLogger(FormKelolaTagihan.class.getName()).log(Level.SEVERE, null, e);
        }
    }//GEN-LAST:event_tCariSiswaKeyPressed

    private void tabelTagihanMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelTagihanMouseClicked
        // TODO add your handling code here:
        int row = tabelTagihan.getSelectedRow();
        String nis = tabelTagihan.getValueAt(row, 0).toString();
        String namaKelas = tabelTagihan.getValueAt(row, 1).toString();
        String namaSiswa = tabelTagihan.getValueAt(row, 2).toString();
        String tahunAjaran = tabelTagihan.getValueAt(row, 3).toString();
        String biayaBulan = tabelTagihan.getValueAt(row, 4).toString();
        tNIS.setText(nis);
        tNamaKelas.setText(namaKelas);
        tNamaSiswa.setText(namaSiswa);
        tTahunAjaran.setText(tahunAjaran);
        tBiayaBulan.setText(biayaBulan);
        bSimpan.setEnabled(true);
        bSimpan.setText("Update");
    }//GEN-LAST:event_tabelTagihanMouseClicked

    private void bKeluarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bKeluarActionPerformed
        // TODO add your handling code here:
        FormUtama utama = new FormUtama();
        utama.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_bKeluarActionPerformed

    private void bKeluarTabelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bKeluarTabelActionPerformed
        // TODO add your handling code here:
        jInternalFrame.setVisible(false);
    }//GEN-LAST:event_bKeluarTabelActionPerformed

    private void bBatalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bBatalActionPerformed
        // TODO add your handling code here:

        batal();
    }//GEN-LAST:event_bBatalActionPerformed

    private void totalBiayaJteksFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_totalBiayaJteksFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_totalBiayaJteksFieldActionPerformed

    private void tBiayaBulanKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tBiayaBulanKeyReleased
        // TODO add your handling code here:

        double a = Double.parseDouble(tBiayaBulan.getText()) * 12;
        totalBiayaJteksField.setText(String.valueOf(a));
    }//GEN-LAST:event_tBiayaBulanKeyReleased

    private void bHapusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bHapusActionPerformed
        // TODO add your handling code here:
          int row = tabelTagihan.getSelectedRow();
        String nis = tabelTagihan.getValueAt(row, 0).toString();
        TagihanSiswa k = new TagihanSiswa();
        k.setNIS(nis);
        try {
           Kontrol.getKoneksiTagihan().hapusSiswa(k);
            JOptionPane.showMessageDialog(this, "data berhasil dihapus");
            List<TagihanSiswa> b = (List<TagihanSiswa>) Kontrol.getKoneksiTagihan().getDataTagihanSiswa();
            KelolaTagihanTableModel model = new KelolaTagihanTableModel(b);
            tabelTagihan.setModel(model);
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(this, "data gagal dihapus" + " \n error: " + ex.getMessage());
        }
    }//GEN-LAST:event_bHapusActionPerformed
    public void batal() {
        tNamaSiswa.setText("");
        tNamaKelas.setText("");
        tJenisKelamin.setText("");
        tBiayaBulan.setText("");
        tNamaOrtu.setText("");
        tNoTelepon.setText("");
        tTahunAjaran.setText("");
        totalBiayaJteksField.setText("");
        tNamaSiswa.requestFocus();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FormKelolaTagihan().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bBatal;
    private javax.swing.JButton bHapus;
    private javax.swing.JButton bKeluar;
    private javax.swing.JButton bKeluarTabel;
    private javax.swing.JButton bLihat;
    private javax.swing.JButton bSimpan;
    private javax.swing.JInternalFrame jInternalFrame;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField tBiayaBulan;
    private javax.swing.JTextField tCariSiswa;
    private javax.swing.JTextField tJenisKelamin;
    private javax.swing.JTextField tNIS;
    private javax.swing.JTextField tNamaKelas;
    private javax.swing.JTextField tNamaOrtu;
    private javax.swing.JTextField tNamaSiswa;
    private javax.swing.JTextField tNoTelepon;
    private javax.swing.JTextField tTahunAjaran;
    private javax.swing.JTable tabelTagihan;
    private javax.swing.JTextField totalBiayaJteksField;
    // End of variables declaration//GEN-END:variables
    public final String nis() {
        try {
            String sql = "select max(nis) from tagihan_siswa";
            Connection con = tools.koneksi.getDBConnection();
            java.sql.Statement sta = con.createStatement();
            ResultSet rs = sta.executeQuery(sql);

            rs.next();
            String result = rs.getString(1);
            if (result != null) {
                int no = Integer.parseInt(result);
                no++;
                sql = "" + no;
                while (sql.length() <= 3) {
                    sql = "0" + sql;

                }
                tNIS.setText(sql);
            } else {
                sql = "102801";
                tNIS.setText(sql);
            }
            return sql;

        } catch (SQLException ex) {
            Logger.getLogger(FormKelolaTagihan.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
